version: '3.8'
services:
  web:
    build: .
    command: sh start.sh
    volumes:
      - .:/app
    ports:
      - 8000:8000
    environment:
      - DATABASE_URL=postgresql+asyncpg://fastapi_docker:fastapi_docker_pass@db:5432/fastapi_docker
      - SERVER_ADDR=0.0.0.0
      - SERVER_PORT=8000
    depends_on:
      - db
  db:
    image: postgres:15-alpine
    volumes:
      - postgres_data:/var/lib/postgresql/data/
    expose:
      - 5432
    environment:
      - POSTGRES_USER=fastapi_docker
      - POSTGRES_PASSWORD=fastapi_docker_pass
      - PGPASSWORD=fastapi_docker_pass
      - POSTGRES_DB=fastapi_docker

volumes:
  postgres_data: